"use strict";
cc._RF.push(module, '3ef272VfUFAGpGqY9FZkIFx', 'shareVideoRank');
// scripts/O1ModuleRes/control/shareVideoRank.ts

"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var miniApp_1 = require("../../engines/services/miniGameContent/miniApp");
var gameEngine_1 = require("../../engines/gameEngine");
var shareVideoItem_1 = require("./shareVideoRank/shareVideoItem");
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var shareVideoRank = /** @class */ (function (_super) {
    __extends(shareVideoRank, _super);
    function shareVideoRank() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.pbItem = null;
        _this.tcType = null;
        _this.ndListContent = null;
        return _this;
        // update (dt) {}
    }
    shareVideoRank.prototype.onLoad = function () {
        this.OnSelectType(miniApp_1.SHARE_VIDEO_SORT_TYPE.HOT);
    };
    shareVideoRank.prototype.start = function () {
    };
    shareVideoRank.prototype.OnBtnSwitch = function (target) {
        var num = Number(target.node.name);
        this.OnSelectType(num);
    };
    shareVideoRank.prototype.OnBtnExit = function () {
        this.ndListContent.destroyAllChildren();
        this.node.destroy();
    };
    shareVideoRank.prototype.OnSelectType = function (type) {
        var _this = this;
        gameEngine_1.default.getModules().uiControlModule.showLoading();
        gameEngine_1.default.getServices().miniGameSrv.getAppApiInstance().getShareVideoRank(type, function (data) {
            _this.OnShowList(data);
            gameEngine_1.default.getModules().uiControlModule.hideLoading();
        });
    };
    shareVideoRank.prototype.OnShowList = function (data) {
        var _this = this;
        this.ndListContent.destroyAllChildren();
        this.scheduleOnce(function () {
            //
            for (var _i = 0, data_1 = data; _i < data_1.length; _i++) {
                var info = data_1[_i];
                var node = cc.instantiate(_this.pbItem);
                _this.ndListContent.addChild(node);
                node.getComponent(shareVideoItem_1.default).BindVideoData(info);
            }
        });
    };
    __decorate([
        property(cc.Prefab)
    ], shareVideoRank.prototype, "pbItem", void 0);
    __decorate([
        property(cc.ToggleContainer)
    ], shareVideoRank.prototype, "tcType", void 0);
    __decorate([
        property(cc.Node)
    ], shareVideoRank.prototype, "ndListContent", void 0);
    shareVideoRank = __decorate([
        ccclass
    ], shareVideoRank);
    return shareVideoRank;
}(cc.Component));
exports.default = shareVideoRank;

cc._RF.pop();